# 3.4 Power Amplifier ## 3.4.1 Overview The 8002b power amplifier mainly consists of a speaker and an audio amplification chip. It can amplify small audio signals for about 8.5 times. These amplified sounds will be played through its speaker. Besides, it can also play some music or melodies. ## 3.4.2 Schematic Diagram ![6-4](./media/6-4-2.png) ## 3.4.3 Code Blocks 1. ![j17](./media/j17.png) This block sets tones and durations to emit a certain sound of tone. 2. ![image](./media/j18.png) This block integrates some songs so that you can directly use. 3. ![j19](./media/j19.png) This block stops the play of tones. ## 3.4.4 Test Code ## 3.4.4.1 Build Code There are two ways to upload the code: directly open the code file we provide; or manually build blocks. **Directly open the code file we provide:** 1. Click ![](./media/j68.png) and choose `Load from your computer` ![](./media/j67.png) 2. We have already downloaded the codes on computer desktop, so open the file and choose `3-4-speaker.sb3` **Manually build blocks:** 1. In ![events](./media/events.png), find ![j1](./media/j1.png) block. 2. In ![control](./media/control.png), find and place ![j2](./media/j2.png) block under ![j1](./media/j1.png). ![6-1-4-1-1](./media/6-1-4-1-1.png) 3. In ![spk](./media/spk.png), set frequency to NOTE_C4 and duration to 500 in block![j17](./media/j17.png). 4. Similarly, add NOTE_D4, NOTE_E4, NOTE_F4, NOTE_G4, NOTE_A4, NOTE_B4 5. At last add a ![j19](./media/j19.png). **Complete Test Code** ![6-4](./media/6-4-4-1-1.png) ## 3.4.4.2 Test Result After uploading code, the power amplifier plays Do, Re, Mi, Fa, So, La, Si, in a loop. ## 3.4.5 Extension We make the module to play music. ## 3.4.5.1 Test Code There are two ways to upload the code: directly open the code file we provide; or manually build blocks. **Directly open the code file we provide:** 1. Click ![](./media/j68.png) and choose `Load from your computer` ![](./media/j67.png) 2. We have already downloaded the codes on computer desktop, so open the file and choose `3-4-speaker2.sb3` **Manually build blocks:** ![6-4](./media/6-4-5-1.png) ## 3.4.5.2 Test Result After uploading code, the amplifier plays *Birthday Song*.